$(document).ready(function() {
    showMoreInfo($("#div_"), "imgInfo");
});

function validate() {
    $("#formEdit")
        .validate(
        {

            rules : {
                'name' : "required",
                'email' : {
                    required : true,
                    email : true
                },
                'surname' :  "required",
                'phone' : {
                    required : true
                },
                'mobilePhone' : {
                    required : true
                },
                'password' : "required"
            }
        })
}

function validateProtocolStaff() {
    $("#formEdit")
        .validate(
        {
            rules : {
                'miembroBms.role.id' : "required",
                'person' :  "required"

            }
        })
}



function searchUser(name, role, url){

    $("#person").val(name);

    windowCaller("Select user", url, { "userName": name, "roleid": role });



}

function closeWindows(name, id){
    $.window.closeAll();
    $("#person").val(name);
    $("#personID").val(id);

}

function isMonitor(){
    var value = $("#role option:selected").text();

    if (value.toUpperCase() == 'MONITOR'){
        $("#tr1").show();
    }
    else{
        $("#tr1").hide();


    }
}

function searchSite(url){

    var select = "select#sites";

    var sites = 0;
    if($('#sites').val() != null)
        sites = $('#sites').val()
    var data = {"countries": $('#country').val() };

   $.ajax({
        traditional: true,
        type: "POST",
        url: url,
        data: data,
        success: function(data)
        {
            var options = '<option value="-1">- ALL -</option>';
            for (var i = 0; i < data.length; i++) {
                options += '<option value="' + data[i].Value + '">' + data[i].Text + '</option>';
            }

            $(select).html(options);
        }
    });
}


